package com.plm.mqshequ.utils;

import com.plm.mqshequ.entity.User;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;

/**
 * @author Limi
 * @create 2019-01-17 20:57
 */
public class SessionUtils {

    public static Session getSession(){
        return SecurityUtils.getSubject().getSession();
    }

    public static User getUser(){
        Object obj = getSession().getAttribute("user");
        return obj != null ? (User) obj : null;
    }

    public static void setUser(User user){
        getSession().setAttribute("user", user);
    }

}
